package my;

import my.entity.Person;
import my.util.ArrayList;
import my.util.List;

/**
 * <p>
 * 线性表: 动态数组
 * </p>
 *
 * @author AJun
 * @since 2020/8/10
 */
public class Main02 {

    public static void main(String[] args) {
        List<Person> list = new ArrayList<>();
        list.add(new Person(101, "小黑", 18));
        list.add(new Person(102, "小绿", 20));
        list.add(new Person(103, "小红", 16));
        list.add(new Person(104, "小兰", 19));

        // list.clean();
        // System.gc(); // 提醒 JVM 进行垃圾回收

        list.add(new Person(105, "小紫", 17));
        list.add(null);
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }

        System.out.println(list.indexOf(new Person(105, "小紫", 17)));
        System.out.println(list.indexOf(null));
    }

}
